Skip to content

repos: a submodule pin CI caught does not affect the verdict on ardupilot - #4

Open
peterbarker wants to merge 5 commits into
ArduPilot:mainfrom
peterbarker:submodule-pin-nonblocking
Open

peterbarker wants to merge 5 commits into
ArduPilot:mainfrom
peterbarker:submodule-pin-nonblocking

Conversation

@peterbarker

@peterbarker peterbarker commented Nov 30, 2026 •

Copy link
Copy Markdown

A submodule pin CI caught does not affect the verdict on ardupilot

On ArduPilot/ardupilot, the check-merge-commits CI job (check_submodule_references_exist in Tools/scripts/check_branch_conventions.py) fails a master-targeting PR whose submodule pin is not reachable from that submodule's default branch. When that check has failed on a pin, APReview should rely on it rather than withhold ACCEPT for the same thing.

The rule is a note on the ArduPilot/ardupilot entry in repos.json. A finding that rests only on such a pin not yet being reachable is now neither blocking nor actionable, and the comment mentions it at most as one minor line. Problems with what the pinned commit contains, or with the change that pins it, are judged as before.

Only for a pin CI actually caught. That means a pin listed in ci.pin_check.failures, which the runner reads from the job's log (next section). A red job alone is not enough: it fails for a dozen other reasons. The check also skips PRs to other branches, runs the PR head's copy of the script (so a branch from before ArduPilot/ardupilot@510556e359b runs none), and passes when the GitHub API errors, and the workflow sets no GITHUB_TOKEN. Every pin not listed, and every pin when the log could not be read, is judged normally. So is a listed pin whose reason is missing (CI's "not found in canonical repo") or other. Only a commit that exists in the submodule's repository but is not merged yet (ahead or diverged) is waived. A commit the repository does not have still gets REQUEST CHANGES, since there is nothing to wait for. When the runner cannot fetch it, 3e7401c on main already writes REQUEST CHANGES without running the models. If the runner does fetch it, this note keeps it blocking. CI reads submodule URLs from the PR head's .gitmodules, as the runner does, so a PR that points a submodule at its own fork has its pin checked against that fork. The waiver applies only when the PR leaves the submodule's URL unchanged, as generation 4 suggested. APReview's own reviews of this PR found both earlier wordings would claim CI enforcement where none happened: generation 1 keyed on the base branch having the check, generation 2 on the job having failed.

Review this would have fixed: #20834, generation 9. Its only blocker, the reason for REQUEST CHANGES, was modules/mavlink pinned to the unmerged ArduPilot/mavlink#528, while check-merge-commits was red for exactly that pin. With this rule the pin plays no part, and the verdict comes from its other findings alone.

Discovery reads which pins CI's check failed

discovery: read which submodule pins CI's check failed. The passes saw CI as one state (failing, pending or passing) and have no network, so they could not tell a pin failure from any other failure in the job. A repository's entry may now name the job that runs the check (pin_check; only ArduPilot/ardupilot does). When that job failed on the head being reviewed, discovery reads its log and adds ci.pin_check: the job, its state, and the pins the log reports as failed, each with commit, path, pinned sha prefix and a reason (ahead, diverged, missing or other). "Ahead" also matches the checker's wording from before ArduPilot/ardupilot@182796ab64f (2026-11-17), "(it is ahead of master)". CI runs the PR head's copy of the script, so older branches still print it, as generation 4 found. Only those fixed-format fields are kept, because the log echoes paths from the PR's own .gitmodules. failures is null when the log could not be read, and a job that did not fail is not read at all. As with the thread, the log is read only for a PR that will be reviewed, not one reused at its published head. The pins parsed from a job are kept for the rest of the discovery, because a finished job's log never changes. Generation 3 found every discovery downloading it again.

GitHub serves a job log through a redirect to a presigned blob-storage URL. The pinned connection to api.github.com refuses that redirect, and must, since it would carry the token there. So GitHub.job_log() goes through gh, which follows the redirect without sending the token.

Checked against the real log of #20834's check-merge-commits: it yields exactly modules/mavlink@efd3b9f8df78, diverged, and skips that run's PASS and SKIP lines. A live ci() on that head through the production transport returns the same. New tests cover each job state and when the log is read. New pinfailonly, pinjobfailed, pinreuse, pincache and pinaheadold mutations are all caught.

CI runs the whole suite again (two precursor commits)

CI has been red on every push to main since 2026-09-28, so it has not been gating anything.

  • tests: run the store and supervisor tests in CI again. review_fixtures.workspace() hard-coded /data/review/supervisor-tests, which a GitHub runner cannot create, so every store, supervisor, lock, guardian, gc, integration and pilot test died in setup with 384 errors. It now reads REVIEW_TEST_DIR like the other tests already did, still defaulting to /data/review, and the workflow sets it to the runner's temp directory. mutate.py strips the tests' environment, so it now passes REVIEW_TEST_DIR through when it is set.
  • tests: expire the manifest cache relative to now, not to boot. One test marked a cache entry expired with a time.monotonic() stamp of 0. On a runner booted less than MANIFEST_AGE (120 s) earlier, that entry is still fresh. The test now stamps it relative to now.

With both fixes, CI runs and passes all 997 tests in all 23 files, the first green run since September.

Reports show a merged finding once

render: show a merged finding once, on the finding it was merged into. The report page hid refuted findings but not merged ones, so every finding the reconciliation folded into another was still listed as an item of its own, with its own BLOCKING or ISSUE tag. The verdict already ignores both, so the page disagreed with it. #20834 generation 9 showed its one pin blocker three times, each as BLOCKING. APReview#4 generation 1 listed the cold pass's copy of primary:F2 as a third ISSUE, whose own text said it had been merged so that it is reported once.

Merged findings are now hidden. Each shown finding is labelled with its id, because the rationales refer to one another that way ("same fix as primary:F1") and the page gave no way to tell which item that was. A finding that others were merged into lists them, following chains, so agreement between the passes stays visible, for example primary:F2 (also cold:F1).

Nothing needs migrating. A pending comment checks its section against a fresh render and repairs the page from the store when they differ, and published pages keep verifying against their own digests until they are next published. A new render test, built from those two reports, fails on the old renderer (six items, two of them BLOCKING) and passes now. A new rendermerged mutation is caught by it.

With everything in this PR, the suite is 1006 tests.

🤖 Generated with Claude Code

@peterbarker peterbarker added the AIReview Request an automated AI review of this PR label Nov 30, 2026
@peterbarker
peterbarker force-pushed the submodule-pin-nonblocking branch 2 times, most recently from 80dfa9b to d6c4e56 Compare November 30, 2026 00:34
@AP-Review

AP-Review commented Nov 30, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-30)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head b4fc04d9d4.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/apreview/4/1.html#prAPReview-4

Reviewed at b4fc04d; the PR head has since moved to d6c4e56, which this review does not cover. The rule makes sense, but its trigger can waive a pin that CI never actually checked.

Should fix

  • repos.json:40: the gate is wrong. CI runs the PR head's copy of check_branch_conventions.py, not the base's, and the check skips any target other than master. So a master PR whose head predates the check (or a release branch that later gets the check by backport) satisfies the note while CI checks nothing. Apply the waiver only when the PR targets master and check-merge-commits on this head reported FAIL for that pin.
  • repos.json:40: 'CI already blocks merging' is not guaranteed. On HTTP 403/429/5xx or a network error the submodule check prints SKIP and passes, so an unreachable pin can go green while the review says CI enforces it. The same fix covers this: require an observed FAIL for that pin.

Not fully reviewed: commits after b4fc04d, up to the current head d6c4e56.

Head moved during review: observed d6c4e56eaa08b353af6e9307e1dd3df9b1d188b5. This review covers only b4fc04d9d46be1c6e817a625998f8907676f2d73; followup eligible.

@peterbarker
peterbarker force-pushed the submodule-pin-nonblocking branch 2 times, most recently from e19dd24 to 175d29a Compare November 30, 2026 02:26
@AP-Review

AP-Review commented Nov 30, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-30)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 175d29a5ea.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/apreview/4/2.html#prAPReview-4

Reviewed at 175d29a, which is still the PR head. Since the last review, the note applies only to master PRs whose check-merge-commits failed on the reviewed head, and green, skipped or running jobs and API errors now get normal judgement. Those earlier gate problems are fixed, apart from the gap below.

Should fix

  • repos.json:40: the gate (still open, narrowed). A red check-merge-commits job does not mean the pin check failed. That job runs 13 checks plus install and board-compile steps, and the pin check prints SKIP and passes on API errors. So an unrelated failure, such as one long subject line while the API is rate-limited, gets the pin waived. The SKIP-in-log exception rarely helps, because the reviewer normally sees only an aggregate CI state. Waive only when the log shows a FAIL line for that exact pin; otherwise judge the pin normally.
Minor (1)

review_fixtures.workspace() put every test store under a hard-coded
/data/review/supervisor-tests. That exists on the review box, where /tmp
is RAM, but a GitHub runner cannot create /data, so every test built on
it died in setUp: the store, supervisor, lock, guardian, gc, integration
and pilot suites, 384 errors and no assertion failures. CI has been red
on main for every push since the fixture arrived with slice one
(fd8fac7, 2026-09-28), so it has not been gating anything since.

The drain, gc, context and schema-description tests already read
REVIEW_TEST_DIR, defaulting to /data/review. Make the shared fixture do
the same, and set it to the runner's temp directory in the workflow.
mutate.py runs the tests with a stripped environment, so pass the
variable through to them when it is set. The box keeps its default.

With REVIEW_TEST_DIR set, the whole suite passes locally: 997 tests in
23 files, on Python 3.12.
test_manifests_are_built_once_for_a_burst_of_refreshes marked its cache
entry expired with a stamp of 0. The stamp is time.monotonic(), which
counts from boot, and the entry lives MANIFEST_AGE (120 s), so on a
machine up for less than two minutes 0 is still fresh and the second
build never happens. The review box and long-running workstations never
see that; a GitHub runner, booted moments before the tests, does - it
was the one failure left once CI could run these tests again.

Stamp it MANIFEST_AGE and a second before now instead. Reproduced and
checked by running the test with monotonic() offset to 30 s after boot:
fails before, passes after.
core() hid refuted outcomes but not merged ones, so every finding the
reconciliation folded into another was still listed on the page as an
item of its own, with its own blocking/actionable tag. The verdict
already ignores both (review_schema: outcomes not refuted or merged),
so the page disagreed with it. ardupilot#20834 generation 9 showed its
one pin blocker three times, as BLOCKING each time; APReview#4
generation 1 listed the cold pass's copy of primary:F2 as a third ISSUE
whose text said it had been "merged so that it is reported once".

Hide merged outcomes, and name each shown finding by its id, since the
rationales refer to one another that way ("same fix as primary:F1") and
the page gave no way to tell which item that was. A finding that others
were merged into lists them, following chains, so agreement between the
passes stays visible: "primary:F2 (also cold:F1)".

A render change needs nothing migrated: a pending comment checks its
section against a fresh render and repairs the page from the store when
it differs, and published pages keep verifying against their own
digests until next published.

Adds a render test built from those two reports and a rendermerged
mutation, which the test catches.
@peterbarker
peterbarker force-pushed the submodule-pin-nonblocking branch from 175d29a to c7e75f5 Compare November 30, 2026 04:30
@AP-Review

AP-Review commented Nov 30, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-30)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head c7e75f5dcf.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/apreview/4/3.html#prAPReview-4

Reviewed at c7e75f5, which is still the PR head. Since the last review, the pin waiver needs the check-merge-commits log to show a FAIL line for that exact pin, rather than just a red job, and the /data/review comment wording is fixed.

Minor (1)
  • runner/bin/review_discovery.py:864: the failed job's log is downloaded on every discovery for every ardupilot candidate, including ones that are reused, dropped or closed, and it bypasses the HTTP cache because it goes through gh. A completed job's log never changes, so cache the parsed result by job id, or read it only for a candidate that will be reviewed.

@peterbarker
peterbarker force-pushed the submodule-pin-nonblocking branch from c7e75f5 to f406f2f Compare November 30, 2026 07:01
@peterbarker peterbarker changed the title repos: a submodule pin CI already blocks does not affect the verdict … repos: a submodule pin CI caught does not affect the verdict on ardupilot Nov 30, 2026
@peterbarker
peterbarker force-pushed the submodule-pin-nonblocking branch from f406f2f to 9fde886 Compare November 30, 2026 07:37
@AP-Review

AP-Review commented Nov 30, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-30)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 9fde886b2d.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/apreview/4/4.html#prAPReview-4

Reviewed at 9fde886, which is still the PR head. Since the last review (at c7e75f5), the check-merge-commits log is read only for a PR that will be reviewed, and is cached per job, so the repeated download is fixed.

Should fix

  • runner/bin/review_discovery.py:888: the ahead pattern matches only the current checker wording '(it is ahead)'. ArduPilot's script printed '(it is ahead of master)' until 2026-11-17, and CI runs the PR head's copy. So a PR branched before then with an unmerged pin gets reason 'other', and the waiver does not apply. Match both wordings, and add the older line to the PinCheck fixture.
Minor (1)
  • repos.json:43: the 9fde886 commit message says the runner can review a fork commit CI cannot find, but CI reads the same PR-head .gitmodules URL. A pin repointed at a fork is checked against that fork, and failures does not record which repository was checked. This is informational: CI is still red on the pin, and the URL change is judged normally.

The passes see CI as one state, failing, pending or passing, which
cannot say whether ArduPilot's check-merge-commits job failed on a
submodule pin or on any of its other dozen checks and steps. Its pin
check also passes when GitHub's API errors (the workflow sets no
GITHUB_TOKEN), so a red job does not show a pin was caught, and the
passes have no network to read the log themselves. APReview#4
generation 2 found that gap in the pin rule that follows.

A repository's entry may now name the job that runs that check
(pin_check). When that job failed on the head being reviewed,
discovery reads its log and adds ci.pin_check: the job, its state, and
the pins its log reports as failed - commit, path, pinned sha prefix
and why, as ahead, diverged, missing or other. Ahead matches both the
checker's wording and the one it had before ArduPilot's 182796ab64f
(2026-11-17), since CI runs the PR head's copy of the script and older
branches still print "(it is ahead of master)". Only those fixed-format
fields are kept, since the log echoes paths from the PR's own
.gitmodules. failures is null when the log could not be read, and a job
that did not fail is not read at all. Only ArduPilot/ardupilot names
one. Like the thread, the log is read only for a PR that will be
reviewed, not one reused at its published head, and the pins parsed
from a job are kept for the rest of the discovery, since a finished
job's log never changes; APReview#4 generation 3 found every discovery
downloading it again.

GitHub serves a job log through a redirect to a presigned blob-storage
URL. The pinned connection refuses redirects off api.github.com, and
must, since it would carry the token there, so GitHub.job_log() goes
through gh, which follows it without sending the token.

Checked against the real log of ardupilot#20834's check-merge-commits
(job 141121645777): it yields exactly modules/mavlink@efd3b9f8df78,
diverged, and skips the run's PASS and SKIP lines. A live ci() on that
head through the production transport returns the same. Adds tests for
each job state and for when the log is read, and pinfailonly,
pinjobfailed, pinreuse, pincache and pinaheadold mutations, all
caught.
…ilot

On ArduPilot/ardupilot, the check-merge-commits job runs
Tools/scripts/check_branch_conventions.py, whose
check_submodule_references_exist fails a master-targeting PR whose
submodule pin is not reachable from that submodule's default branch.
When that check has failed on a pin, the review should rely on it rather
than withhold ACCEPT for the same thing: a finding that rests only on
that pin not yet being reachable is now neither blocking nor
actionable, and the comment mentions it at most as one minor line.

Only for a pin CI actually caught, as listed in ci.pin_check.failures,
which discovery reads from that job's log. The job fails for many other
reasons, and the check skips PRs to other branches, runs the PR head's
copy of the script (so a branch from before 510556e359b, 2026-04-08,
runs none) and passes when the GitHub API errors. Every pin not listed,
and every pin when the log could not be read, is judged normally.
So is a listed pin whose reason is missing (CI's "not found in
canonical repo") or other: only a commit that exists in the
submodule's repository but is not merged yet (ahead or diverged) is
waived, and a commit the repository does not have still blocks: there
is nothing to wait for. When the runner cannot fetch such a commit,
3e7401c on main already writes REQUEST CHANGES without running the
models; if it does fetch it, this note keeps it blocking.

CI and the runner both use the submodule URL in the PR head's
.gitmodules, so a PR that points a submodule at its own fork has its
pin checked against that fork. The waiver applies only when the PR
leaves the submodule's URL unchanged; otherwise the pin is judged
normally. APReview#4 generation 4 raised this.
APReview's own reviews of this PR found both earlier wordings would
claim CI enforcement where none happened: generation 1 keyed on the
base branch having the check, generation 2 on the job having failed.

Problems with what the pinned commit contains, or with the change that
pins it, are judged as before and can still affect the verdict.

Review this would have fixed: ArduPilot/ardupilot#20834, generation 9
(head 3721de5427), REQUEST CHANGES whose only blocker was modules/mavlink
pinned to the unmerged ArduPilot/mavlink#528, while check-merge-commits
was red for exactly that (run 46191040519, job 141121645777).

Submodules of ardupilot keep their own notes and are unaffected.
@peterbarker
peterbarker force-pushed the submodule-pin-nonblocking branch from 9fde886 to 1eefa35 Compare November 30, 2026 10:11
@peterbarker peterbarker changed the title repos: a submodule pin CI caught does not affect the verdict on ardupilot repos: a submodule pin CI caught does not affect the verdict on ardupilot Nov 30, 2026
@AP-Review

Copy link
Copy Markdown

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: ACCEPT

Reviewed at head 1eefa3528c.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/apreview/4/5.html#prAPReview-4

Reviewed at 1eefa35, which is still the PR head. Since the last review (at 9fde886), the parser accepts the older '(it is ahead of master)' wording. The note and commit message now say CI and the runner use the same PR-head submodule URL, and they waive a pin only when that URL is unchanged.

Note

  • runner/bin/review_discovery.py:909: the three label discoveries run in parallel on one Discovery, and the job-log cache has no lock. So a PR with more than one review label can have the same log downloaded up to three times in one run. The results are identical, and this matches the existing per-label thread reads, so no change is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AIReview Request an automated AI review of this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants